package net.bwie.realtime.jtp.dws.trade.job;

import org.apache.flink.configuration.Configuration;
import org.apache.flink.table.api.EnvironmentSettings;
import org.apache.flink.table.api.Table;
import org.apache.flink.table.api.TableEnvironment;

public class JtpOrderProvinceAggregateDwsJob {
    public static void main(String[] args) {
        // 创建tableEnv
        TableEnvironment tableEnv=getTableEnv();
        // 创建输入表-input
        createInputTable(tableEnv);
        // 处理数据-select
//        Table resulTable = handle(tableEnv);
//        createOutputTable(tableEnv);
//        saveToKafka(tableEnv,resulTable);
    }

    private static void createInputTable(TableEnvironment tableEnv) {

    }

    private static TableEnvironment getTableEnv() {
        //  创建TableEnv
        EnvironmentSettings build = EnvironmentSettings.newInstance()
                .useBlinkPlanner()
                .inStreamingMode()
                .build();
        TableEnvironment tableEnv = TableEnvironment.create(build);
        //设置时区
        Configuration configuration = tableEnv.getConfig().getConfiguration();
        configuration.setString("table.local-time-zone", "Asia/Shanghai");
        configuration.setString("table.exec.resource.default-parallelism", "1");
        configuration.setString("table.exec.state.ttl", "5 s");
        return tableEnv;
    }
}
